import request from '@/utils/request';
import type { HttpResult } from '@/api';
import type { AddSysModule, EditSysModule, SysModule } from './model';

// 新增
export const add = async (data: AddSysModule): Promise<HttpResult<SysModule>> => {
  const res = await request.post<HttpResult<SysModule>>(
    '/system/sysModule/add',
    data,
  );
  return res.data;
};

//删除
export const del = async (ids: string[]): Promise<HttpResult<boolean>> => {
  const res = await request.post<HttpResult<boolean>>(
    '/system/sysModule/delete',
    ids,
  );
  return res.data;
};

//修改
export const edit = async (data: EditSysModule): Promise<HttpResult<SysModule>> => {
  const res = await request.post<HttpResult<SysModule>>(
    '/system/sysModule/edit',
    data,
  );
  return res.data;
};

//查询分页
export const queryList= async (): Promise<HttpResult<SysModule[]>> => {
  const res = await request.post<HttpResult<SysModule[]>>(
    '/system/sysModule/queryList',{}
  );
  return res.data;
};

//查询分页
export const queryPage = async (data: { pageNo: number, pageSize: number }): Promise<HttpResult<SysModule>> => {
  const res = await request.post<HttpResult<SysModule>>(
    '/system/sysModule/queryPage',
    data,
  );
  return res.data;
};

